﻿using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace socket客户端
{
    public class WriteFile
    {

        public static bool WriteFileByReceive(string content)
        {
			try
			{
                SaveFileDialog saveFileDialog = new SaveFileDialog();
                saveFileDialog.Title = "保存接收的文件";
                saveFileDialog.Filter = "(*.txt)|*.txt";
                saveFileDialog.DefaultExt = "txt";
                saveFileDialog.FileName = "保存的文件" + DateTime.Now.ToString("yyyyMMddHHmmss");

                if (saveFileDialog.ShowDialog() == true)
                {
                    File.WriteAllText(saveFileDialog.FileName, content);

                    return true;
                }

                return false;
            }
			catch (Exception)
			{

				throw;
			}
        }
    }
}
